package com.taxshare.purchaser.util;

import lombok.extern.slf4j.Slf4j;

import java.io.File;

/**
 * @ClassName: DeleteFileUtil
 * @Description:
 * @author: hjh
 * @date: 2021/5/21 9:00
 */
@Slf4j
public class DeleteFileUtil {
    /**
     * 删除单个文件
     *
     * @param fileName
     *            被删除文件的文件名
     * @return 单个文件删除成功返回true,否则返回false
     */
    public static boolean deleteFile(String fileName) {
        File file = new File(fileName);
        if (file.isFile() && file.exists()) {
            file.delete();
            log.info("删除单个文件:{fileName},成功！", fileName);
            return true;
        } else {
            log.info("删除单个文件:{fileName},失败！", fileName);
            return false;
        }
    }
}
